using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

using SypEngine;
using SypEngine.SiteConfig;
using SypConst.Garbage;
using SypConst.Path;

namespace SypEngine
{
    [Serializable]
    public class SypSite : SypGarbageObject
    {
        public int SiteId;
        public int AlbumIdToReload = -1;
        public string SiteUrl = null;
        public List<int> AlbumToZip = null;

        public string Language = null;
        public string SiteTitle = null;
        
        public ConnectionMode SiteConnectionMode;
        public TransferConf SypTfConf;

        public string design = null;


        private bool Tranfering = false;
        private bool Processing = false;

        //private FTPConf SiteFTPConf;
        public List<Category> CategorysList = null;

        public int PictureHeight = 480;
        public int PictureWidth = 640;


        //Filter settings
        public List<string> PictureFilter = null;

        //Local informations
        public string LocalImagePath = null;

        public bool isTranfering
        {
            set
            {
                lock (Tranfering as object)
                {
                   Tranfering = value;
                }
            }
            get
            {
                return Tranfering;
            }
        }

        public bool isProcessing
        {
            set
            {
                lock (Processing as object)
                {
                    Processing = value;
                }
            }
            get
            {
                return Processing;
            }
        }

        /*
        public void addAlbumForZipping(int id)
        {
            if (AlbumToZip == null)
                AlbumToZip = new List<int>();
            if (!AlbumToZip.Contains(id))
                AlbumToZip.Add(id);
        }

        public void rmAlbumForZipping(int id)
        {
            if (AlbumToZip != null)
            {
                if (AlbumToZip.Contains(id))
                    AlbumToZip.Remove(id);
            }
        }*/

        public SypSite() {  }

        public SypSite(SetText OutputMethod)
            : base(OutputMethod)
        {
        }

        public SypSite(string design, string Title, ref List<int> SiteIdUsedList)
        {
            //SiteId = SypGarbage.GenerateId(ref SiteIdUsedList);
            SiteId = SypGarbageConf.Instance().GenerateId();
            SiteTitle = Title;
            this.design = design;
        }


        // deep copy in separeate memory space


        public SypSite(string design, string Title, ref List<int> SiteIdUsedList, string myURL)
        {
           // SiteId = SypGarbage.GenerateId(ref SiteIdUsedList);
            SiteId = SypGarbageConf.Instance().GenerateId();
            SiteTitle = Title;
            this.design = design;

            SiteUrl = myURL;
        }
    }
}


